Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve spans for specialization error #98782

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

compiler-errors
Copy link
Member

Fixes #98777

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 1, 2022
@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2022
_ => {
tcx.sess
.struct_span_err(span, &format!("cannot specialize on `{:?}`", predicate))
.struct_span_err(span, &format!("cannot specialize on predicate `{}`", predicate))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other predicates have a display impl, why not use it

tcx.sess
.struct_span_err(
span,
&format!("cannot specialize on associated type `{projection_ty} == {term}`",),
Copy link
Member Author

@compiler-errors compiler-errors Jul 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, i guess i could rebind projection_ty if it has bound vars, but i don't think people are specializing on for<'a> Ty: Trait<Proj = &'a ()>, so it's not necessarily worth the complexity I guess. Also we'd need to skip the binder on term still, so we don't print for<..> assoc == for<..> term..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, not really worth it for the diagnostic. You could emit another note if the binders actually bind anything stating that specialization on lifetimes is not... ideal. But unless we have some good specialization docs for that that we could link to, not really worth it.

@@ -384,9 +389,17 @@ fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tc
.emit();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't leave a comment on line (new) 385 (old 380), but we should probably just print the whole trait ref instead of just the def path...?

@bors
Copy link
Contributor

bors commented Jul 1, 2022

☔ The latest upstream changes (presumably #93967) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 4, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 4, 2022

📌 Commit a368830 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jul 4, 2022
…r-span, r=oli-obk

Improve spans for specialization error

Fixes rust-lang#98777
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 4, 2022
…r-span, r=oli-obk

Improve spans for specialization error

Fixes rust-lang#98777
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 4, 2022
…r-span, r=oli-obk

Improve spans for specialization error

Fixes rust-lang#98777
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 4, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#98738 (Clarify MIR semantics of checked binary operations)
 - rust-lang#98782 (Improve spans for specialization error)
 - rust-lang#98793 (Lint against executable files in the root directory)
 - rust-lang#98814 (rustdoc: Censor certain complex unevaluated const exprs)
 - rust-lang#98878 (add more `rustc_pass_by_value`)
 - rust-lang#98879 (Fix "wrap closure in parenthesis" suggestion for `async` closure)
 - rust-lang#98886 (incr.comp.: Make split-dwarf commandline options [TRACKED].)
 - rust-lang#98898 (Add "no-div-regex" eslint rule)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit da630de into rust-lang:master Jul 5, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 5, 2022
@compiler-errors compiler-errors deleted the specialization-error-span branch August 11, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

min_specialization: cannot specialize on Binder(ProjectionPredicate(..))
5 participants